//登录页面js

//获取用户注册信息做非空验证及密码强度验证


$('.submit').on('click', function (e) {
    e = e || window.event
    e.preventDefault()

    let user = $('input[name="userName"]').val()
    let pass = $('input[name="passWord"]').val()
    if (user == '') {
        $('#register p').html('用户名不能为空')
    } else if (pass == '') {
        $('#register p').html('密码不能为空')

    } else {
        $('#register p').html('')
        axios({
            method: 'post',
            url: 'http://api.yuguoxy.com/api/member/login',
            data: {
                username: user,
                password: pass,
            }
        }).then(response => {
            let data = response.data
            if (data.resultCode == 1) {
                alert('登录成功')
                localStorage.setItem('USER', JSON.stringify(data.resultInfo))
                location.href = '../pages/index.html'
            } else {
                $('#register p').html('用户名或密码错误')
            }
        })
    }


})